﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Office.Tools.Ribbon;
using Microsoft.Office.Tools;
using System.Threading;

namespace ExcelRSS
{
    public partial class MainRibbon : OfficeRibbon
    {
        public MainRibbon()
        {
            InitializeComponent();
        }

        private void MainRibbon_Load(object sender, RibbonUIEventArgs e)
        {

        }

        /// <summary>
        /// Shows the RSS Feed
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnShowFeed_Click(object sender, RibbonControlEventArgs e)
        {
            ShowCTP();
        }

        private void ShowCTP()
        {
            CustomTaskPane ctp = Globals.ThisAddIn.CustomTaskPanes.Add(new RssHost(CboFeed.Text), "RSS Feed");
            ctp.Width = 400;
            ctp.DockPosition = Microsoft.Office.Core.MsoCTPDockPosition.msoCTPDockPositionRight;
            ctp.Visible = true;
        }
    }
}
